home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.neu.edu!johnson
- From: jdangel@lynx.dac.neu.edu (Jeff Dangel)
- Newsgroups: comp.lang.c++
- Subject: Constructors with variable length arg lists?
- Date: Thu, 29 Feb 1996 13:38:37 GMT
- Organization: Northeastern University, Boston, MA. 02115, USA
- Message-ID: <3135a83d.902477@chaos.dac.neu.edu>
- NNTP-Posting-Host: trix.ccs.neu.edu
- X-Newsreader: Forte Agent .99d/32.182
-
- Hi.
-
- I am trying to come up with a way to allow users of my class to
- initialize a declaration with multiple members.
-
-
- In C:
-
- typedef struct X {
- char c;
- int i;
- } mystruct;
-
- mystruct s[] = { {'a', 1}, {'b', 2}, {'c', 3} };
-
-
- In C++:
-
- class Thing{
- public:
- Thing(); //default
- Thing( ??????????); // I want this one to accept an init list
- private:
- LinkedList datamembers;
- };
-
- Use which?
-
- Thing X = { {item1}, {item2}, ...};
- or
- Thing X( item1, item2, ... );
- or
- Thing X[] = Item list of some sort.
-
- Thanks in advance for any help!
-
- --- Jeff
-
-
-
- How can I do this?
-
-